
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="ntModalLabel" type='{$request}'>{$title}</h4>
            </div>
            <div class="modal-body">
                <div class="row clearfix">
                    <div class="col-md-12 column">
                        <div class="alert alert-dismissable alert-info">
                            <button type="button" class="close">×</button>
                            <p></p>
                        </div>
                    </div>
                </div>
                <div class="row clearfix">
                    <div class="col-md-12">
                        <table class="table table-hover ntTable">
                            <tbody>
                                <tr>
                                    <td>{:lang('type')}<span class="required"></span></td>
                                    <td>
                                        <label class="radio-inline">
                                        	<input type="radio" name="type" value="general_terms" checked> {:lang("general_terms")}
                                        </label>
                                        <label class="radio-inline">
                                        	<input type="radio" name="type" value="delivery_terms" {if isset($terms.type)}{if condition="$terms.type eq 'delivery_terms'"}checked{/if}{/if}> {:lang("delivery_terms")}
                                        </label>
                                        <label class="radio-inline">
                                        	<input type="radio" name="type" value="payment_terms" {if isset($terms.type)}{if condition="$terms.type eq 'payment_terms'"}checked{/if}{/if}> {:lang("payment_terms")}
                                        </label>
                                        <label class="radio-inline">
                                        	<input type="radio" name="type" value="after_sales_terms" {if isset($terms.type)}{if condition="$terms.type eq 'after_sales_terms'"}checked{/if}{/if}> {:lang("after_sales_terms")}
                                        </label>
                                    </td>
                                </tr>
                                <tr>
                                    <td>{:lang('article_content')}<span class="required"></span></td>
                                    <td><textarea style="width:100%;height:20vh" id="content">{if isset($terms.content)}{$terms.content}{/if}</textarea></td>
                                </tr>
                                <tr>
                                    <td>{:lang("It's_necessary_or_not")}</td>
                                    <td>
                                        <label class="checkbox-inline">
                                        	<input type="checkbox" name="require" id="is_must" value="yes" {if isset($terms.is_must)}{if condition="$terms.is_must eq 1"}checked{/if}{/if}> {:lang('required_clauses_are_automatically_added_to_the_contract_by_default')}。
                                        </label>
                                    </td>
                                </tr>
                                <input type="hidden" name="" id="id" value="{if isset($terms.id)}{$terms.id}{/if}">
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span>{:lang('cancel')}</button>
                <button type="button" class="btn btn-primary save" style="padding-left:24px;padding-right:24px"><span class="glyphicon glyphicon-floppy-disk"></span>{:lang('save')}</button>
            </div>
            <script type="text/javascript">
                $('.save').click(function(){
                    // console.log($('#is_must').prop('checked'));
                    if($('#ntModalLabel').attr('type') == 'add'){
                        var url = '/admin/buyterms/addTerms?request=insert';
                    }else{
                        var url = '/admin/buyterms/editTerms?request=update';
                    }
                    $.ajax({
                        url:url,
                        type:'post',
                        data:{
                            type:$(':radio[name="type"]:checked').val(),
                            content:$('#content').val(),
                            is_must:$('#is_must').prop('checked'),
                            id:$('#id').val()
                        },
                        success:(data)=>{
                            data = JSON.parse(data)
                            if(data.status == 1){
                                change_mes_type('.alert',data.status)
                                $('#terms_editModal').modal('hide')
                                $('.alert').show()
                                $('.alert p').html(data.msg)    
                            }else{
                                change_mes_type('.modal-body .alert',data.status)
                                $('.modal-body .alert').show()
                                $('.modal-body .alert p').html(data.msg)   
                            }
                            
                        }
                    })
                });
            </script>
